package edu.ccut.saturn.studio.menuitem.page;

import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.editor.FormPage;
import org.eclipse.ui.forms.widgets.ScrolledForm;

import edu.ccut.saturn.studio.core.util.eclipse.Messages;
import edu.ccut.saturn.studio.menuitem.editor.MenuItemsEditor;
import edu.ccut.saturn.studio.menuitem.model.MenuItemModel;

public class MenuItemsPage extends FormPage {

	private MenuItemsEditor editor;

	private MenuItemMasterDetailsBlock block;

	private MenuItemModel menuItemModel;

	public MenuItemsPage(FormEditor formeditor) {
		super(formeditor, "menuItems", Messages.getString("MenuItemsPage.menu")); //$NON-NLS-1$ //$NON-NLS-2$

		editor = (MenuItemsEditor) formeditor;
		menuItemModel = editor.getMenuItemModel();

		block = new MenuItemMasterDetailsBlock(this, editor);
	}

	public MenuItemModel getMenuItemModel() {
		return menuItemModel;
	}

	protected void createFormContent(IManagedForm managedForm) {
		ScrolledForm form = managedForm.getForm();
		form.setText(Messages.getString("MenuItemsPage.menutree")); //$NON-NLS-1$

		block.createContent(managedForm);
	}
}
